/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// NOTE: This entire file should be codegen'ed.

#include "SampleTurboModuleSpec.h"

using namespace rnoh;
using namespace facebook;

static jsi::Value hostFunction_NativeSampleTurboCxxModuleSpecJSI_pushStringToHarmony(jsi::Runtime &rt,
    react::TurboModule &turboModule,
    const jsi::Value *args,
    size_t count)
{
    return jsi::Value(static_cast<ArkTSTurboModule &>(turboModule).call(rt, "pushStringToHarmony", args, count));
}

static jsi::Value hostFunction_NativeSampleTurboCxxModuleSpecJSI_registerFunction(jsi::Runtime &rt,
    react::TurboModule &turboModule,
    const jsi::Value *args,
    size_t count)
{
    return jsi::Value(static_cast<ArkTSTurboModule &>(turboModule).call(rt, "registerFunction", args, count));
}

static jsi::Value hostFunction_NativeSampleTurboCxxModuleSpecJSI_doAsyncJob(jsi::Runtime &rt,
    react::TurboModule &turboModule,
    const jsi::Value *args, size_t count)
{
    return jsi::Value(static_cast<ArkTSTurboModule &>(turboModule).callAsync(rt, "doAsyncJob", args, count));
}

static jsi::Value hostFunction_NativeSampleTurboCxxModuleSpecJSI_getPreferencesData(jsi::Runtime &rt,
    react::TurboModule &turboModule,
    const jsi::Value *args,
    size_t count)
{
    return jsi::Value(static_cast<ArkTSTurboModule &>(turboModule).call(rt, "getPreferencesData", args, count));
}

static jsi::Value hostFunction_NativeSampleTurboCxxModuleSpecJSI_putPreferencesData(jsi::Runtime &rt,
    react::TurboModule &turboModule,
    const jsi::Value *args,
    size_t count)
{
    return jsi::Value(static_cast<ArkTSTurboModule &>(turboModule).call(rt, "putPreferencesData", args, count));
}

static jsi::Value hostFunction_NativeSampleTurboCxxModuleSpecJSI_rnLog(jsi::Runtime &rt,
    react::TurboModule &turboModule,
    const jsi::Value *args, size_t count)
{
    return jsi::Value(static_cast<ArkTSTurboModule &>(turboModule).call(rt, "rnLog", args, count));
}

NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const ArkTSTurboModule::Context ctx,
                                                               const std::string name)
    : ArkTSTurboModule(ctx, name)
{
    methodMap_["pushStringToHarmony"] =
        MethodMetadata{1, hostFunction_NativeSampleTurboCxxModuleSpecJSI_pushStringToHarmony};
    methodMap_["registerFunction"] =
        MethodMetadata{0, hostFunction_NativeSampleTurboCxxModuleSpecJSI_registerFunction};
    methodMap_["doAsyncJob"] = MethodMetadata{1, hostFunction_NativeSampleTurboCxxModuleSpecJSI_doAsyncJob};
    methodMap_["rnLog"] = MethodMetadata{1, hostFunction_NativeSampleTurboCxxModuleSpecJSI_rnLog};
    methodMap_["putPreferencesData"] =
        MethodMetadata{1, hostFunction_NativeSampleTurboCxxModuleSpecJSI_putPreferencesData};
    methodMap_["getPreferencesData"] =
        MethodMetadata{0, hostFunction_NativeSampleTurboCxxModuleSpecJSI_getPreferencesData};
}